﻿/*  
    Copyright (C) <2007-2013>  <Kay Diefenthal>

    ArgusTv.UI.MediaCenter is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    ArgusTv.UI.MediaCenter is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with ArgusTv.UI.MediaCenter.  If not, see <http://www.gnu.org/licenses/>.
*/

using System;
using System.Collections;
using Microsoft.MediaCenter.UI;

namespace ArgusTV.UI.MediaCenter.Views
{
    public class ScheduleManualView : ModelItem
    {
        private IList _commands;
        private Choice _keepUntilModeFilters;
        private Choice _scheduleChannelFilters;
        private Choice _scheduleDates;
        private Choice _scheduleGroupFilters;
        private Choice _scheduleIncidence;
        private EditableText _scheduleName;
        private Choice _schedulePriorityFilters;
        private EditableText _scheduleStartHour;
        private EditableText _scheduleStartMinute;
        private EditableText _scheduleStopHour;
        private EditableText _scheduleStopMinute;
        private Choice _scheduleTypeFilters;
        //private BooleanChoice _monday;
        //private BooleanChoice _tuesday;
        //private BooleanChoice _wednesday;
        //private BooleanChoice _thursday;
        //private BooleanChoice _friday;
        //private BooleanChoice _saturday;
        //private BooleanChoice _sunday;

        /// <summary>
        ///     The Commands in the view.
        ///     This Commands should only contain object of type Command.
        /// </summary>
        public IList Commands
        {
            get { return _commands; }
            set
            {
                if (_commands != value)
                {
                    _commands = value;
                    FirePropertyChanged("Commands");
                }
            }
        }

        /// <summary>
        ///     The ScheduleGroupFilters Spinner in the view.
        ///     This ScheduleGroupFilters should only contain objects of type ScheduleGroupFilter.
        /// </summary>
        public virtual Choice ScheduleGroupFilters
        {
            get { return _scheduleGroupFilters; }
            set
            {
                if (_scheduleGroupFilters != value)
                {
                    if (_scheduleGroupFilters != null)
                        _scheduleGroupFilters.ChosenChanged -= OnScheduleGroupFilterChanged;
                    _scheduleGroupFilters = value;
                    if (_scheduleGroupFilters != null)
                        _scheduleGroupFilters.ChosenChanged += OnScheduleGroupFilterChanged;
                    OnScheduleGroupFilterChanged(_scheduleGroupFilters, EventArgs.Empty);
                    FirePropertyChanged("ScheduleGroupFilters");
                }
            }
        }

        /// <summary>
        ///     The ScheduleChannelFilters Spinner in the view.
        ///     This ScheduleChannelFilters should only contain objects of type ScheduleChannelFilter.
        /// </summary>
        public virtual Choice ScheduleChannelFilters
        {
            get { return _scheduleChannelFilters; }
            set
            {
                if (_scheduleChannelFilters != value)
                {
                    _scheduleChannelFilters = value;
                    FirePropertyChanged("ScheduleChannelFilters");
                }
            }
        }

        /// <summary>
        ///     The ScheduleName TextBox in the view.
        ///     This EditableText should only contain object of type EditableText.
        /// </summary>
        public virtual EditableText ScheduleName
        {
            get { return _scheduleName; }
            set
            {
                if (_scheduleName != value)
                {
                    _scheduleName = value;
                    FirePropertyChanged("ScheduleName");
                }
            }
        }

        /// <summary>
        ///     The ScheduleStartDate TextBox in the view.
        ///     This ScheduleStartDate should only contain object of type EditableText.
        /// </summary>
        public virtual Choice ScheduleDates
        {
            get { return _scheduleDates; }
            set
            {
                if (_scheduleDates != value)
                {
                    _scheduleDates = value;
                    FirePropertyChanged("ScheduleDates");
                }
            }
        }

        /// <summary>
        ///     The ScheduleStartHour TextBox in the view.
        ///     This ScheduleStartHour should only contain object of type EditableText.
        /// </summary>
        public virtual EditableText ScheduleStartHour
        {
            get { return _scheduleStartHour; }
            set
            {
                if (_scheduleStartHour != value)
                {
                    _scheduleStartHour = value;
                    FirePropertyChanged("ScheduleStartHour");
                }
            }
        }

        /// <summary>
        ///     The ScheduleStartMinute TextBox in the view.
        ///     This ScheduleStartMinute should only contain object of type EditableText.
        /// </summary>
        public virtual EditableText ScheduleStartMinute
        {
            get { return _scheduleStartMinute; }
            set
            {
                if (_scheduleStartMinute != value)
                {
                    _scheduleStartMinute = value;
                    FirePropertyChanged("ScheduleStartMinute");
                }
            }
        }

        /// <summary>
        ///     The ScheduleDuration TextBox in the view.
        ///     This ScheduleDuration should only contain object of type EditableText.
        /// </summary>
        public virtual EditableText ScheduleStopHour
        {
            get { return _scheduleStopHour; }
            set
            {
                if (_scheduleStopHour != value)
                {
                    _scheduleStopHour = value;
                    FirePropertyChanged("ScheduleStopHour");
                }
            }
        }

        public virtual EditableText ScheduleStopMinute
        {
            get { return _scheduleStopMinute; }
            set
            {
                if (_scheduleStopMinute != value)
                {
                    _scheduleStopMinute = value;
                    FirePropertyChanged("ScheduleStopMinute");
                }
            }
        }

        /// <summary>
        ///     The SchdeuleIncidenceFilters Spinner in the view.
        ///     This SchdeuleIncidenceFilters should only contain objects of type SchdeuleIncidenceFilter.
        /// </summary>
        public virtual Choice ScheduleIncidence
        {
            get { return _scheduleIncidence; }
            set
            {
                if (_scheduleIncidence != value)
                {
                    _scheduleIncidence = value;
                    FirePropertyChanged("ScheduleIncidence");
                }
            }
        }

        /// <summary>
        ///     The SchedulePriorityFilters Spinner in the view.
        ///     This SchedulePriorityFilters should only contain objects of type SchedulePriorityFilter.
        /// </summary>
        public virtual Choice SchedulePriorityFilters
        {
            get { return _schedulePriorityFilters; }
            set
            {
                if (_schedulePriorityFilters != value)
                {
                    _schedulePriorityFilters = value;
                    FirePropertyChanged("SchedulePriorityFilters");
                }
            }
        }

        /// <summary>
        ///     The ScheduleTypeFilters Spinner in the view.
        ///     This ScheduleTypeFilters should only contain objects of type ScheduleTypeFilter.
        /// </summary>
        public virtual Choice ScheduleTypeFilters
        {
            get { return _scheduleTypeFilters; }
            set
            {
                if (_scheduleTypeFilters != value)
                {
                    _scheduleTypeFilters = value;
                    FirePropertyChanged("ScheduleTypeFilters");
                }
            }
        }

        /// <summary>
        ///     The KeepUntilModeFilters Spinner in the view.
        ///     This KeepUntilModeFilters should only contain objects of type KeepUntilModeFilter.
        /// </summary>
        public virtual Choice KeepUntilModeFilters
        {
            get { return _keepUntilModeFilters; }
            set
            {
                if (_keepUntilModeFilters != value)
                {
                    _keepUntilModeFilters = value;
                    FirePropertyChanged("KeepUntilModeFilters");
                }
            }
        }


        public event EventHandler ScheduleGroupFilterChanged;

        protected virtual void OnScheduleGroupFilterChanged(object sender, EventArgs args)
        {
            if (ScheduleGroupFilterChanged != null)
                ScheduleGroupFilterChanged(this, EventArgs.Empty);
        }
    }
}